<?php

namespace App\Http\Requests\Api;

use Illuminate\Foundation\Http\FormRequest;

class ChannelRequest extends FormRequest
{
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        switch($this->method()) {
            case 'POST':
                return [
                    'title' => 'required|string|max:191',
                    'link'  => 'required|string',
                ];
                break;
            case 'PUT':
                return [
                    'title' => 'string|max:191',
                    'link'  => 'string',
                ];
                break;
        }
    }
    
    public function attributes()
    {
        return [
            'title' => '栏目名称',
            'link' => '链接设置',
        ];
    }
}
